﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="frmCidadeEdit.aspx.cs" Inherits="ordserv.frmCidadeEdit" %>

<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">

                <asp:FormView ID="FormView1" runat="server" 
        DataKeyNames="IdCidade" DataSourceID="DSCidade" DefaultMode="Edit" Width="662px" 
                    onitemupdated="FormView1_ItemUpdated" 
                    onitemcommand="FormView1_ItemCommand" oniteminserted="FormView1_ItemInserted">
                    <EditItemTemplate>
                        <table style="width: 633px">
                            <tr>
                                <td style="width: 37px">
                                    <asp:Label ID="Label1" runat="server" Text="Label">Nome:</asp:Label>
                                </td>
                                <td style="width: 270px"><asp:TextBox ID="NomeTextBox" runat="server" Text='<%# Bind("Nome") %>' 
                                        MaxLength="50" Width="200px" />
                                                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                        ControlToValidate="NomeTextBox" 
                                        ErrorMessage="O nome da cidade é de preenchimento obrigatório">*</asp:RequiredFieldValidator>
                                                                   </td>
                            </tr>
                            <tr>
                                <td style="width: 37px">
                                    <asp:Label ID="Label2" runat="server" Text="UF:"></asp:Label>
                                </td>
                                <td style="width: 270px">
                                    <asp:TextBox ID="UFTextBox" runat="server" MaxLength="2" 
                                        Text='<%# Bind("UF") %>' Width="60px" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                        ControlToValidate="UFTextBox" 
                                        ErrorMessage="a UF é de preenchimento obrigatório">*</asp:RequiredFieldValidator>
                                </td>
                           </tr>
                            <tr>
                                <td style="width: 37px">
                                    &nbsp;</td>
                                <td style="width: 270px">
                                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" Width="525px" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                    <asp:Button ID="Button1" runat="server" CommandName="Update" Text="Salvar" />
                                    <asp:Button ID="Button2" runat="server" CommandName="Cancel" Text="Cancelar" 
                                        CausesValidation="False" />
                                </td>
                        </table>
                        
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        Nome:
                        <asp:TextBox ID="NomeTextBox" runat="server" Text='<%# Bind("Nome") %>' />
                        <br />
                        UF:
                        <asp:TextBox ID="UFTextBox" runat="server" Text='<%# Bind("UF") %>' />
                        <br />
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                            CommandName="Insert" Text="Insert" />
                        &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                            CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                    </InsertItemTemplate>
    </asp:FormView>
    <asp:ObjectDataSource ID="DSCidade" runat="server" InsertMethod="Insert" 
        SelectMethod="SelectByID" TypeName="ordserv.Bussiness.CidadeBS" 
        UpdateMethod="Update">
        <UpdateParameters>
            <asp:Parameter Name="IdCidade" Type="Int32" />
            <asp:Parameter Name="Nome" Type="String" />
            <asp:Parameter Name="UF" Type="String" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="IDCidade" QueryStringField="ID" Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="Nome" Type="String" />
            <asp:Parameter Name="UF" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>

</asp:Content>
